package org.fall.mvc.hander;

import crowd.entity.Admin;
import org.fall.service.api.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
@ResponseBody
@Controller
public class TestHander {
    @Autowired
    private AdminService adminService;


    @RequestMapping("send/array.html")
    public String testReceiveArrayOne(@RequestParam("array[]") List<Integer> array){
        for (Integer number : array){
            System.out.println("number="+number);
        }
        return "/wabapp/WEB-INF/target.jsp";
    }

    @RequestMapping("test/ssm.html")
    public String testSsm(ModelMap modelMap) {
        List<Admin> adminList = adminService.getAll();
        modelMap.addAttribute("adminList",adminList);
        return "target";
    }
}
